
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;


public class e023 {
    public static void main(String[] args) {
        long sTime = System.currentTimeMillis();
        int limit = 28123;
        HashSet<Integer> allNums = new HashSet<Integer>();
        for (int j = 0; j < limit; j++) {
            allNums.add(j);
        }
	ArrayList<Integer> abundants = abundants(limit);
        int iIndex = 0;
        while (iIndex < abundants.size()) {
            int jIndex = iIndex;
            int i = abundants.get(iIndex);
            while (jIndex < abundants.size()) {
                int j = abundants.get(jIndex);
                allNums.remove(j + i);
                jIndex++;
            }
            iIndex++;
        }
        Iterator itr = allNums.iterator();
        int sum = 0;
        while (itr.hasNext()) {
            sum += Integer.parseInt(String.valueOf(itr.next()));
        }
        System.out.println(sum);
        long fTime = System.currentTimeMillis();
        System.out.println("Time: " + (fTime - sTime) + "ms");
    }

    static boolean isAbundant(int i) {
        int sum = 0;
        for (int n = 1; n <= i / 2; n++) {
            if (i % n == 0) {
                sum += n;
            }
        }
        return (sum > i);
    }

    static ArrayList<Integer> abundants(int i) {
        ArrayList<Integer> abundants = new ArrayList<Integer>();
        for (int n = 12; n < i; n++) {
            if(isAbundant(n)) {
                abundants.add(n);
            }
        }
        return abundants;
    }
}